import java.util.LinkedList;


public class Invariant {
	LinkedList<Inequalite> invariant;
	public Invariant(){invariant = new LinkedList<Inequalite>();}
	public Invariant(LinkedList<Inequalite> inq){
		invariant = inq;
	}
	public Invariant(String s,EnsembleVariable ev){
		//String s = "{inegalite1,inegalite2,...,inegaliten}"
		String ms = s;
		int i=0; 
		int carLu=s.charAt(i);

		StringBuffer buffer = new StringBuffer();
		invariant= new LinkedList<Inequalite>();
		do{
	
			buffer.delete(0,buffer.length());
			i++;
			carLu = s.charAt(i);
			
			do{
				buffer.append((char)carLu);
				i++; 
				carLu = s.charAt(i);
			}while(",}".indexOf(carLu)==-1);
			
			ms = buffer.toString();
			Inequalite tmp = new Inequalite(ms,ev);
			invariant.add(tmp);
		}while(carLu!='}');


	}
	
	public void publish(EnsembleVariable ev){

		int l = invariant.size();
		System.out.println("INV:");
	//	System.out.println("numbre of inequation:"+ l);
		for(int j = 0 ; j< l ;j++){
			invariant.get(j).pulish(ev);System.out.println();
		}
	}
}
